﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace House_Control
{
    //This class will handle everything dealing with Alarms in the house
    class Alarm
    {
        //alarm types: 0=Door Sensor, 1=Window Sensor, 2=Motion Detector/Camera, 3=Smoke Detector, 4=Fire Alarm
        public const int DOOR = 0;
        public const int WINDOW = 1;
        public const int MOTION = 2;
        public const int SMOKE = 3;
        public const int FIRE = 4;

        private int alarmType;
        private int securityCompanyNo;
        private int fireDeptNo;
        public Log log = Program.log;
        private int roomNo;
        public Boolean armed = false;
        public Boolean tripped = false;

        public Alarm(int alarmType, int roomNo)
        {
            this.alarmType = alarmType;
            this.roomNo = roomNo;
        }
        
        public void arm() 
        {
            armed = true;
            log.append("Arming " + alarmString() + " alarm for room #" + roomNo);
        }
        public void disarm() 
        {
            armed = false;
            log.append("Disarming " + alarmString() + " alarm for room #" + roomNo);
        }
        public void callSecurityCompany()
        {
            log.append("Calling Security Company");
        }
        public void callOwner()
        {
            log.append("Calling Owner");
        }
        public void call911()
        {
            log.append("Calling 911");
        }
        public void callFireDepartment()
        {
            log.append("Calling Fire Department");
        }
        public void deactivate()
        {
            tripped = false;
            armed = false;
            log.append(alarmString() + " alarm for room #" + roomNo + " dactivated");
        }
       /* public void sendToLog()
        {

        }*/
        public String alarmString() //convert the current alarm number into a readable string
        {
            switch (alarmType)
            {
                case 0: return "Window";
                case 1: return "Door";
                case 2: return "Motion Detector";
                case 3: return "Smoke Detector";
                case 4: return "Fire Alarm";
                default: return "invalid";
            }
        }
        public int getType()
        {
            return alarmType;
        }
        public int getRoomNo()
        {
            return roomNo;
        }
    }
}
